﻿//---------------------------------------------------------------------------------
// Copyright 2011 Microsoft Corporation
// Licensed under the Microsoft Public License (MS-PL) (the "License"); 
// You may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.opensource.org/licenses/ms-pl.html
// THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR 
// CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, 
// INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR 
// CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 
// MERCHANTABLITY OR NON-INFRINGEMENT. 
// See the Microsoft Public License (MS-PL) for the specific language governing 
// permissions and limitations under the License.
//---------------------------------------------------------------------------------

using System;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Controls;

namespace ControlTestApplications.Silverlight.Dashboard
{
    public partial class AuthPrompt : ChildWindow
    {
        string authUrl = string.Empty;

        /// <summary>
        /// Initializes a new instance of the <see cref="AuthPrompt"/> class.
        /// </summary>
        /// <param name="authUrl">The auth URL.</param>
        public AuthPrompt(string authUrl)
        {
            InitializeComponent();
            this.authUrl = authUrl;
        }

        #region event handlers
        private void DoneButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void lnkAuthorise_Click(object sender, RoutedEventArgs e)
        {
            HtmlPage.Window.Navigate(new Uri(authUrl, UriKind.Absolute), "_blank", "");
        }

        #endregion
    }
}